﻿/*
 * Created by SharpDevelop.
 * User: LBALERI
 * Date: 07/02/2013
 * Time: 08:57 a.m.
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Data.OleDb;
using System.Data;
using System.Windows.Forms;

namespace CapturaImagen
{
	/// <summary>
	/// Description of ConexionDatos.
	/// </summary>
	public class ConexionDatos
	{
		static string CadenaConexion;
		static OleDbConnection Conex;
		
		public ConexionDatos()
		{

		}
		public static OleDbConnection  conectarAccess(){
			try {
				
				String ubicacion = Application.StartupPath + @"\Data\Original\AtributosFundadora.accdb";
				CadenaConexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+ubicacion+";Persist Security Info=False";
				Conex = new OleDbConnection(CadenaConexion);
				
			} catch (Exception ex) {
                EscribirLog.escribirArchivo(ex.Message);
				Conex = null;
				MessageBox.Show("Error de Conexión!!","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
			return Conex;
		}
		public static void desconectarAccess(){
			Conex.Close();
		}
	}
}
